<!-- 团体会员-参会人员- -->
<template>
  <div>
    <div class="gl_px_15">
      <div class="gl_my_15">
        <el-table ref="memberTable" v-loading="loading" :data="staffData" size="mini">
          <el-table-column type="index" label="序号" />
          <el-table-column prop="userPhoneNumber" label="登录账号">
            <template slot-scope="{row}">
              <span>
                {{ row.userPhoneNumber ? row.userPhoneNumber : '- -' }}
              </span>
            </template>
          </el-table-column>
          <el-table-column prop="name" label="姓名" />
          <el-table-column prop="phoneNumber" label="联系方式">
            <template slot-scope="{row}">
              <span>
                {{ row.phoneNumber ? row.phoneNumber : '- -' }}
              </span>
            </template>
          </el-table-column>
          <el-table-column prop="idCardNumber" label="证件号码">
            <template slot-scope="{row}">
              <span>
                {{ row.idCardNumber ? row.idCardNumber : '- -' }}
              </span>
            </template>
          </el-table-column>
          <el-table-column prop="registerTags" label="账户角色">
            <template slot-scope="{row}">
              <span v-if="row.registerTags.length <= 0">- -</span>
              <span v-for="tag in row.registerTags" v-else :key="tag.id">
                <el-tag size="mini gl_mr_10">{{ tag.registerTagType.name }}</el-tag>
              </span>
            </template>
          </el-table-column>
          <el-table-column label="实名认证">
            <template slot-scope="{row}">
              <span v-if="row.isApproved == true" class="gl_color_success">
                <i class="el-icon-success" />
                <span class="gl_pl_5">通过</span>
              </span>
              <span v-else class="gl_color_grey">
                <i class="el-icon-error" />
                <span class="gl_pl_5">未通过</span>
              </span>
            </template>
          </el-table-column>
        </el-table>
        <el-row class="gl_pt_20" style="text-align: center;">
          <el-pagination
            :current-page="Api_GET_EventsManagementRegisterQO.Page"
            :page-size="Api_GET_EventsManagementRegisterQO.MaxResultCount"
            :total="totalPage"
            layout="total,sizes,prev,pager,next,jumper"
            :page-sizes="[10, 20, 50, 100]"
            @size-change="sizeChange"
            @current-change="pageIndexChange"
          />
        </el-row>
      </div>
    </div>
  </div>
</template>

<script>
import {
  api_GET_EventsManagementRegister
} from '@/extend/api/gameswaggerApi/app.js';
import {
  Api_GET_EventsManagementRegisterQO
} from '@/lib/form/game/swaggerForm';
export default {
  name: 'Staff',
  props: {
    isShow: {
      type: Boolean
    }
  },
  data() {
    return {
      loading: false,
      currentPage: 1,
      totalPage: 0, // 分页总条目数
      Api_GET_EventsManagementRegisterQO: new Api_GET_EventsManagementRegisterQO(),
      staffData: [] // 表格数据
    };
  },
  watch: {
    isShow: {
      handler: function(val) {
        if (val) {
          this.getstaff();
        }
      },
      immediate: true,
      deep: true
    }
  },
  methods: {
    // 获取团体下的人员
    getstaff(page) {
      this.loading = true;
      this.Api_GET_EventsManagementRegisterQO.Page = page || 1;
      this.Api_GET_EventsManagementRegisterQO.SkipCount = (this.Api_GET_EventsManagementRegisterQO.Page - 1) * this.Api_GET_EventsManagementRegisterQO.MaxResultCount;
      const data = this.Api_GET_EventsManagementRegisterQO;
      data.IncludeTags = true;
      data.DelegationId = this.$route.query.delegationId ? this.$route.query.delegationId : this.$route.query.id;
      data.IsApproved = null;
      api_GET_EventsManagementRegister(data).then(res => {
        this.staffData = res.items;
        this.totalPage = res.totalCount;
        this.loading = false;
      }).catch(() => {
        this.loading = false;
      });
    },
    // 分页
    sizeChange: function(MaxResultCount) {
      this.Api_GET_EventsManagementRegisterQO.MaxResultCount = MaxResultCount;
      this.getstaff();
    },
    pageIndexChange(currentPage) {
      this.getstaff(currentPage);
    }
  }
};
</script>

<style>
</style>
